@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
        .layui-table{width: 97%;margin: 0 auto;margin-top: 20px;}
        .modal-func-btns {justify-content: flex-start !important;}
        .layui-form-select dl {min-width: 86%;}
        .new-table {margin: 20px 0;}
    </style>
@endsection
@include('Home.User.Common._meta')
<!----  职位 已投递简历  ---->
<div class="modal-content new-table" id="addNew-content2">
    <div class="layui-form">
        <table class="layui-table">
            <thead>
            <tr>
                <th>ID</th>
                <th>招聘时间</th>
                <th>紧急程度</th>
                <th>所属公司</th>
                <th width="180">职位名称</th>
                <th>工作地点</th>
                <th>薪资范围</th>
{{--
                <th>职位类别</th>
--}}
                <th>需求状态</th>
                <th>悬赏金</th>
                <th>推荐结果</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($list as $item)
                <tr>
                    <td data-label="ID"> {{$item->id}} </td>
                    <td data-label="招聘时间"> {{$item->position->time}} </td>
                    <td data-label="紧急程度"> {{$item->position->emergency_name}} </td>
                    <td data-label="所属公司"> {{$item->client_name}} </td>
                    <td data-label="职位名称"> {{$item->position->title}} </td>
                    <td data-label="工作地点"> {{$item->position->region_name}} </td>
                    <td data-label="薪资范围"> {{$item->position->range_name}} </td>
{{--
                    <td data-label="职位类别"> {{$item->position->category_name}} </td>
--}}
                    <td data-label="需求状态"> {{$item->position->state_name}} </td>
                    <td data-label="悬赏金"> {{$item->position->reward}} </td>
                    <td data-label="推荐结果"> {{$item->result_name}} </td>
                    <td data-label="操作" class="tac layui-row layui-col-space10">

                        <?php $user = Auth::user()->load('frame'); ?>
                        @if(Auth::user()->type==1 && $user->frame && $user->frame->branch_id==1)
                            <a href="javascript:;" class="edit-btn edit-client" onclick="open_button('{{route('position_edit',$item->position->id)}}','查看/编辑职位')" title="查看/编辑职位"><i class="layui-icon">&#xe642;</i></a>
                            <a href="javascript:;" class="edit-btn edit-client" onclick="open_button('{{route('add_resume_schedule',$item->id)}}','查看/添加跟进记录')" title="查看/添加跟进记录"><i class="layui-icon">&#xe63c;</i></a>
                                @if (Auth::user()->hasAnyRole(['admin']) || Auth::user()->id==$item->assign)
                                    <a href="javascript:;" class="edit-btn add-schedule" onclick="del('{{route('del',$item->id)}}')" title="删除"><i class="layui-icon">&#xe640;</i></a>
                                @endif
                        @endif

                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>

        <!-- 分页 s -->
        @if($num>1)
            <div class="news-pager">
                <ul class="pagination" id="page">
                </ul>
                <div class="pageJump">
                    <span>跳转到</span>
                    <input type="text"/>
                    <span>页</span>
                    <button type="button" class="button">确定</button>
                </div>
            </div>
        @endif
        <!-- 分页 e -->
    </div>

</div>
@section('footer')
    <script type="text/javascript">
        layui.use('form', function(){
            var form = layui.form;
            var $ = layui.jquery;
            form.on('checkbox(allChoose)', function(data) {
                var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                child.each(function(index, item) {
                    item.checked = data.elem.checked;
                });
                form.render('checkbox');
            });
        });
        function del(url) {
            layer.confirm("你确定要删除吗？此操作不能撤销！", {icon: 3, title:'提示'},
                    function(index){//确定回调
                        $.ajax({
                            type: 'get',
                            url: url,
                            dataType: 'json',
                            success: function(data){
                                if(data.code){
                                    window.location.reload();
                                    layer.close(index);
                                }else{
                                    layer.msg(data.msg,{icon: 5,time:1000});
                                }
                            },
                            error:function() {
                                layer.msg('服务器错误!',{icon: 5,time:1000});
                            }
                        });
                    },function (index) {//取消回调
                        layer.close(index);
                    }
            );
        }
        /***  分页 JS  ***/
        Page({
            num: '{{$num}}',		//页码数
            startnum: '{{$page}}',				//指定页码
            elem:$('#page'),		//指定的元素
            callback:function(n){	//回调函数
                window.location.href = '{{route('resume_position',$obj->id)}}?page='+n;
            }
        });
    </script>
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')